n, m = list(map(int, input().split()))
T = [[] for i in range(n)]
x = 0
d = [1] * n
for i in range(n):
a = list(map(int, input().split()))
T[i] = a
x ^= a[0]
for i in range(n):
for j in range(m):
if x ^ T[i][0] ^ T[i][j] != 0:
print('TAK')
d[i] = j + 1
print(*d)
exit()
print('NIE')
#include<bits/stdc++.h>
using namespace std;
long long n, m, i, j, a[507][507], res, row, col;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> n >> m;
for(i = 1; i <= n; i++)
{
for(j = 1; j <= m; j++)
{
cin >> a[i][j];
}
res ^= a[i][1];
}
if(res)
{
cout << "TAK\n";
for(i = 1; i <= n; i++) cout << "1 ";
return 0;
}
for(i = 1; i <= n; i++)
{
for(j = 2; j <= m; j++)
{
if(a[i][j] != a[i][1])
{
res = 1;
row = i;
col = j;
break;
}
}
if(res == 1) break;
}
if(res)
{
cout << "TAK\n";
for(i = 1; i <= n; i++)
{
if(row != i) cout << "1 ";
else cout << col << " ";
}
return 0;
}
cout << "NIE";
}
1331B - Limericks | 305B - Continued Fractions |
1165B - Polycarp Training | 1646C - Factorials and Powers of Two |
596A - Wilbur and Swimming Pool | 1462B - Last Year's Substring |
1608B - Build the Permutation | 1505A - Is it rated - 2 |
169A - Chores | 765A - Neverending competitions |
1303A - Erasing Zeroes | 1005B - Delete from the Left |
94A - Restoring Password | 1529B - Sifid and Strange Subsequences |
1455C - Ping-pong | 1644C - Increase Subarray Sums |
1433A - Boring Apartments | 1428B - Belted Rooms |
519B - A and B and Compilation Errors | 1152B - Neko Performs Cat Furrier Transform |
1411A - In-game Chat | 119A - Epic Game |
703A - Mishka and Game | 1504C - Balance the Bits |
988A - Diverse Team | 1312B - Bogosort |
1616B - Mirror in the String | 1660C - Get an Even String |
489B - BerSU Ball | 977C - Less or Equal |